-- @owner: lvlintao666
-- @date: 2022/04/12
-- @testpoint: 数组类型在触发器中的使用，insert语句触发

--step1:建表;expect:成功
drop table if exists t_ustore_datatype_array_0098_1;
create table t_ustore_datatype_array_0098_1(c_id int not null,c_name varchar2(20)[]) with (storage_type=ustore);
drop table if exists t_ustore_datatype_array_0098_2;
create table t_ustore_datatype_array_0098_2(c_column varchar2(15),c_type varchar2(15)) with (storage_type=ustore);

--step2:创建触发器;expect:成功
create or replace function  tri_insert_func() returns trigger as
$$
declare
begin
    insert into t_ustore_datatype_array_0098_2 values('row','insert');
    return new;
end
$$ language plpgsql;
/
create  trigger fvt_array_trigger_001 after insert on t_ustore_datatype_array_0098_1 for each row execute procedure tri_insert_func();
/
--step3:插入数据;expect:成功
insert into t_ustore_datatype_array_0098_1 values(1,array['高斯', '{gaogaisou高斯}', null, '123456', '高gao斯', '2019-09-08']);
insert into t_ustore_datatype_array_0098_1 values(1,array[1]);
select * from t_ustore_datatype_array_0098_1;
select * from t_ustore_datatype_array_0098_2;

--step4:环境清理;expect:成功
drop trigger fvt_array_trigger_001 on t_ustore_datatype_array_0098_1 cascade ;
drop function tri_insert_func() cascade;
drop table t_ustore_datatype_array_0098_1;
drop table t_ustore_datatype_array_0098_2;